"""Project URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.urls import path
from myadmin.views import login, user, hosts, cluster
from dao import get_nodes
urlpatterns = [
    # 登录路由
    path('login', login.login, name='myadmin_login'),
    path('logout', login.logout, name='myadmin_logout'),
    path('register', login.register, name='myadmin_register'),  # 注册

    # 用户路由
    path('user', user.index, name='myadmin_user_index'),  # 浏览信息
    path('user/insert', user.insert, name='myadmin_user_insert'),  # 执行信息添加
    path('user/delete/<int:uid>', user.delete, name='myadmin_user_delete'),  # 删除信息
    path('user/update/<int:uid>', user.update, name='myadmin_user_update'),  # 授权
    path('user/resetpass/<int:uid>', user.resetpass, name="myadmin_user_resetpass"),  # 重置用户密码

    # 主机路由
    path('hosts', hosts.index, name='myadmin_hosts_index'),  # 浏览主机信息
    path('hosts/insert', hosts.insert, name='myadmin_hosts_insert'),  # 插入主机
    path('hosts/delete/<int:uid>', hosts.delete, name='myadmin_hosts_delete'),  # 删除主机
    path('hosts/update/<int:uid>', hosts.update, name='myadmin_hosts_update'),  # 编辑主机
    path('hosts/refresh', hosts.refresh, name='myadmin_hosts_refresh'),  # 扫描主机

    # 集群路由
    path('cluster', cluster.index, name='myadmin_cluster_index'),  # 集群信息浏览
    path('cluster/insert', cluster.insert, name='myadmin_cluster_insert'),  # 添加集群
    path('cluster/delete/<int:uid>', cluster.delete, name='myadmin_cluster_delete'),  # 删除集群
    path('cluster/update/<int:uid>', cluster.update, name='myadmin_cluster_update'),  # 编辑集群
    path('cluster/refresh', cluster.refresh, name='myadmin_cluster_refresh'),  # 扫描集群
    path('cluster/deploy', cluster.deploy, name='myadmin_cluster_deploy'),  # 一键部署
]
